package com.glela.talent.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.glela.talent.service.TempDealService;

/**
 * 校妆临时文件
 * 
 * @author MaoZeYao
 * 2017年3月20日 下午11:52:49
 *
 */
@Service("tempDealService")
public class TempDealServiceImpl implements TempDealService {
	
//	@Autowired
//	private TempDealMapper tempDealMapper;
//	
//	@Autowired
//	private UserInfoMapper userInfoMapper;

	@Transactional(propagation=Propagation.REQUIRED)
	@Override
	public void dealDataTorTalentTeacher() {/*
		// TODO Auto-generated method stub
		List<StudentWner> stuList = tempDealMapper.selectStudentInfo();
		for (StudentWner deal : stuList) {
			String talentTeacher = tempDealMapper.selectTalentTeacherPersionIdByJobNo(deal.getInstructorPhone());

			for (StudentWner stu : stuList) {
				User user = tempDealMapper.selectUserByMobile(stu.getUserPhone());
				if (user == null) {
					int sign = userInfoMapper.selectUserinfoMaxSign();
					if (sign <= 0) {
						sign = 100000;
					}
					sign += 1;
					String persionId = RandomUtil.getRandomStr(2) + sign;
					User insetUser = new User();
					insetUser.setUserName(stu.getUserPhone());
					insetUser.setRoleId(3);
					insetUser.setRecommendFrom(persionId);
					insetUser.setTalentTeacher(talentTeacher);
					insetUser.setNickName(stu.getUserName());
					tempDealMapper.insertUser(insetUser);

					UserInfo userInfo = new UserInfo();
					userInfo.setPersionId(persionId);
					userInfo.setUserId(insetUser.getId());
					userInfo.setSign(sign);
					userInfo.setSex(2);
					tempDealMapper.insertUserInfo(userInfo);

					tempDealMapper.updateStudentInfo(stu.getId(), "Insert new User");
				} else {
					
					if (user.getRoleId() == 7) continue;
					
					if (user.getRoleId() < 7) {
						tempDealMapper.updateUserRole(user.getId(), talentTeacher);
						tempDealMapper.updateStudentInfo(stu.getId(), "Fail User has Teacher");
					}  
				}
			}
		}
	*/}
}
